package com.example.mall.dto.validator;

import com.example.mall.dto.user.UserSignUpDTO;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class UserSignUpAccountValidator implements ConstraintValidator<UserSignUpAccountEqual, UserSignUpDTO> {
    @Override
    public boolean isValid(UserSignUpDTO signUpDTO, ConstraintValidatorContext constraintValidatorContext) {
        String account = signUpDTO.getAccount();
        String account2 = signUpDTO.getAccount2();
        boolean match = account.equals(account2);

        System.out.println("2次账号比对,检验结果:" + match);
        return match;
    }
}
